home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 1
/
CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso
/
Aminet
/
biz
/
demo
/
StylusDemo.lha
/
Stylus_Demo
/
REXX
/
MovePts.pvrx
< prev
next >
Wrap
Text File
|
1992-03-24
|
3KB
|
143 lines
/* MovePts.pvrx---move selected points by precise increments
in the X or Y axis.
Author: Jeff Blume - August 28, 1991
Copyright © 1991 by Stylus, Inc.
Suggested "ProVector.pvrx" entries:
'Define "MovePts Ctrl-E" "MovePts MENU"'
'DefineKey E "MovePts MENU"'
(Control-E for "Edit" ???)
*/
address "ProVector"
/* Get the argument list to see whether this is a MENU, or an OK */
arg arglist
Cmd = word(arglist,1)
options results
/* Try to get exclusive lock on project window.
If can't get lock, not polite to interrupt. */
'Lock'
if RC ~= 0 then exit
/* This loop is called from the menu */
if Cmd = 'MENU' then
DO
/* Test Selected list for magnetized? */
/* Magnetize Sel Objs for better coord identification.*/
'SelectList' Sel; SelN = Result
if SelN = 0 then do
RC = 100
call Error "NO OBJECT SELECTED!"
end
else do
'Magnetize' SelN Sel
do i = 0 to SelN-1
'SelectObj' Sel.i /* restore selection state */
end
end
'GetBool "Click points; Double Last" "OK" "OK"'
'GetUserData 0 1 100 "MovePts OK" ""'
END
/* end "MENU" loop */
/* This was called from GetUserData */
if Cmd = 'OK' then
DO
'GetInputPoints Pts'; NumIn=Result
'SelectList' Sel; SelN = Result
'PushUndo'
/* Get X and Y shifts */
'GetStr "Move X - Move Y (N1 N2)" "OK" "CANCEL"' /* longest prompt */
MCoords = result
if rc ~= 0 | words(MCoords) ~= 2 then do
RC = 100
call Error "MACRO CANCELED OR BAD COORDS GIVEN"
end
/* extract the X and Y values */
MX = subword(MCoords,1,1)
MY = subword(MCoords,2,1)
'Prompt "Looking for points."'
NumModObjs = 0 /* counter for Objects to be modified */
ModObj.0 = 0 /* index for Objects to be modified */
do i=0 to SelN-1
/* Identify points to be moved */
'GetPoints' Sel.i ObjPts.i; NumPts.i=Result
if RC = 18 then
do
'GetBool "CAN NOT MOVEPT TEXT OR GROUP" "Cancel" "Cancel"'
iterate
end
do p=0 to NumIn-1
call MatchPoint
end
end
'EndPrompt'
if NumModObjs = 0 then do
RC = 100
call Error "NO LEGAL OBJECTS SELECTED!"
end
'Prompt "Moving points!"'
do m=1 to NumModObjs
'SaveUndo' ModObj.m
'ChangePoints' ModObj.m ModNum.m ModPts.m
end
'EndPrompt'
/* De-Magnetize, general cleanup */
'Magnetize' 0 Sel
'Repair'
END
/* end "OK" loop */
'UnLock'
EXIT
ERROR:
arg ErrTxt
if RC ~= 0 & ErrTxt ~= "" then 'GetBool ErrTxt "Cancel" "Cancel"'
'Magnetize' 0 Sel
'EndPrompt'
/*'Repair'*/
'UnLock'
exit
MATCHPOINT:
do j = 0 to NumPts.i-1
select
when ObjPts.i.j.X = Pts.p.X & ObjPts.i.j.Y = Pts.p.Y then
do
ObjPts.i.j.X = ObjPts.i.j.X + MX
ObjPts.i.j.Y = ObjPts.i.j.Y + MY
call CmpModObj
end
when j = NumPts.i-1 then return /* Test next obj */
otherwise iterate
end
end
return
CMPMODOBJ:
/* Compare current obj to list of objs to be modified */
do c=0 to NumModObjs
select
when Sel.i = ModObj.c then leave c /* same as last ModObj */
when Sel.i ~= ModObj.c & c = NumModObjs then /* not on list */
do
NumModObjs = NumModObjs + 1 /* increment number */
ModObj.NumModObjs = Sel.i /* add to list */
ModPts.NumModObjs = ObjPts.i
ModNum.NumModObjs = NumPts.i
end
otherwise iterate
end
end
return